package com.solidit.cassandra.controller.persistance;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.solidit.cassandra.controller.persistance.model.Events;
import com.solidit.cassandra.controller.persistance.util.CassandraConectionManager;

@Service
public class EventsDAO {
	@PersistenceContext
	private EntityManager em;

	@Autowired
	private CassandraConectionManager conn;

//	public Events insert(Events e) {
//		conn.getSession().execute(
//				"INSERT INTO prueba.cliente (id, persona, propiedad, evento) VALUES ("
//						+ e.getId() + "," + e.getNombre() + ")");
//		return e;
//	}

	public List<Events> getTypeEvent() {
		TypedQuery<Events> q = em.createQuery("From Events", Events.class);
		List<Events> resultado = q.getResultList();
		return resultado;
	}

}
